<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"www.wisdomelon.com","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.12.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/./public/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="leetcode 002两数相加(Medium)(链表)">
<meta property="og:type" content="article">
<meta property="og:title" content="leetcode-[2]两数相加">
<meta property="og:url" content="https://www.wisdomelon.com/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/index.html">
<meta property="og:site_name" content="西瓜瓜的小站">
<meta property="og:description" content="leetcode 002两数相加(Medium)(链表)">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://wisdomelon-1.oss-cn-shenzhen.aliyuncs.com/wisblogimg/image-20220613150344328.png">
<meta property="article:published_time" content="2022-06-13T07:35:49.000Z">
<meta property="article:modified_time" content="2022-06-15T01:36:56.466Z">
<meta property="article:author" content="Wisdomelon">
<meta property="article:tag" content="java">
<meta property="article:tag" content="leetcode">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://wisdomelon-1.oss-cn-shenzhen.aliyuncs.com/wisblogimg/image-20220613150344328.png">


<link rel="canonical" href="https://www.wisdomelon.com/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://www.wisdomelon.com/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/","path":"leetcode-2-两数相加/","title":"leetcode-[2]两数相加"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>leetcode-[2]两数相加 | 西瓜瓜的小站</title>
  

  <script src="/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?0a578a72f5b90237c56e9de682e2deb1"></script>




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">西瓜瓜的小站</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">西瓜瓜的小站</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li><li class="menu-item menu-item-links"><a href="/links/" rel="section"><i class="fa fa-link fa-fw"></i>友链</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0-Medium-%E9%93%BE%E8%A1%A8"><span class="nav-text">leetcode-[2]两数相加(Medium)(链表)</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%A2%98%E7%9B%AE%E8%AF%B4%E6%98%8E"><span class="nav-text">题目说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BE%85%E5%8A%A9%E4%BB%A3%E7%A0%81%EF%BC%88%E9%93%BE%E8%A1%A8%EF%BC%89"><span class="nav-text">辅助代码（链表）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E9%A2%98%E7%9B%AE%E5%88%86%E6%9E%90"><span class="nav-text">题目分析</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%A7%A3%E9%A2%98%E6%80%9D%E8%B7%AF"><span class="nav-text">解题思路</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%B9%E6%B3%95%E4%B8%80%EF%BC%9A%E9%80%92%E5%BD%92%E7%B4%AF%E5%8A%A0%E6%B3%95"><span class="nav-text">方法一：递归累加法</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%80%BB%E7%BB%93"><span class="nav-text">总结</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Wisdomelon"
      src="/images/avatar.png">
  <p class="site-author-name" itemprop="name">Wisdomelon</p>
  <div class="site-description" itemprop="description">爱摄影，爱下厨，爱妮子的程序员小哥哥一枚</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">4</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://gitee.com/miniwatermelon" title="Gitee → https:&#x2F;&#x2F;gitee.com&#x2F;miniwatermelon" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>Gitee</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  <div class="post-gallery" itemscope itemtype="http://schema.org/ImageGallery">
    
    <div class="post-gallery-image">
      <img src="https://wisdomelon-1.oss-cn-shenzhen.aliyuncs.com/wisblogimg/image-20220613150344328.png" itemprop="contentUrl">
    </div>
    </div>

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://www.wisdomelon.com/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.png">
      <meta itemprop="name" content="Wisdomelon">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="西瓜瓜的小站">
      <meta itemprop="description" content="爱摄影，爱下厨，爱妮子的程序员小哥哥一枚">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="leetcode-[2]两数相加 | 西瓜瓜的小站">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          leetcode-[2]两数相加
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-06-13 15:35:49" itemprop="dateCreated datePublished" datetime="2022-06-13T15:35:49+08:00">2022-06-13</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2022-06-15 09:36:56" itemprop="dateModified" datetime="2022-06-15T09:36:56+08:00">2022-06-15</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/" itemprop="url" rel="index"><span itemprop="name">数据结构与算法</span></a>
        </span>
    </span>

  
    <span id="/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/" class="post-meta-item leancloud_visitors" data-flag-title="leetcode-[2]两数相加" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span class="leancloud-visitors-count"></span>
    </span>
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>1.7k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>2 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>leetcode 002两数相加(Medium)(链表)</p>
<span id="more"></span>
<h1 id="leetcode-2-两数相加-Medium-链表"><a href="#leetcode-2-两数相加-Medium-链表" class="headerlink" title="leetcode-[2]两数相加(Medium)(链表)"></a>leetcode-[2]两数相加(Medium)(链表)</h1><h2 id="题目说明"><a href="#题目说明" class="headerlink" title="题目说明"></a>题目说明</h2><figure class="highlight txt"><table><tr><td class="code"><pre><span class="line">//给你两个 非空 的链表，表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的，并且每个节点只能存储 一位 数字。 </span><br><span class="line">//请你将两个数相加，并以相同形式返回一个表示和的链表。 </span><br><span class="line">//你可以假设除了数字 0 之外，这两个数都不会以 0 开头。 </span><br><span class="line">//</span><br><span class="line">// 示例 1： </span><br><span class="line">//输入：l1 = [2,4,3], l2 = [5,6,4]</span><br><span class="line">//输出：[7,0,8]</span><br><span class="line">//解释：342 + 465 = 807.</span><br><span class="line">// </span><br><span class="line">// 示例 2：  </span><br><span class="line">//输入：l1 = [0], l2 = [0]</span><br><span class="line">//输出：[0]</span><br><span class="line">// </span><br><span class="line">// 示例 3： </span><br><span class="line">//输入：l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]</span><br><span class="line">//输出：[8,9,9,9,0,0,0,1]</span><br><span class="line">// </span><br><span class="line">// 提示： </span><br><span class="line">// 每个链表中的节点数在范围 [1, 100] 内 </span><br><span class="line">// 0 &lt;= Node.val &lt;= 9 </span><br><span class="line">// 题目数据保证列表表示的数字不含前导零 </span><br><span class="line">// </span><br><span class="line">// Related Topics 递归 链表 数学 </span><br></pre></td></tr></table></figure>

<h2 id="辅助代码（链表）"><a href="#辅助代码（链表）" class="headerlink" title="辅助代码（链表）"></a>辅助代码（链表）</h2><figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Definition for singly-linked list.</span></span><br><span class="line"><span class="comment"> * public class ListNode &#123;</span></span><br><span class="line"><span class="comment"> *     int val;</span></span><br><span class="line"><span class="comment"> *     ListNode next;</span></span><br><span class="line"><span class="comment"> *     ListNode() &#123;&#125;</span></span><br><span class="line"><span class="comment"> *     ListNode(int val) &#123; this.val = val; &#125;</span></span><br><span class="line"><span class="comment"> *     ListNode(int val, ListNode next) &#123; this.val = val; this.next = next; &#125;</span></span><br><span class="line"><span class="comment"> * &#125;</span></span><br><span class="line"><span class="comment"> */</span></span><br></pre></td></tr></table></figure>

<h2 id="题目分析"><a href="#题目分析" class="headerlink" title="题目分析"></a>题目分析</h2><p>对两个链表的相同指针的数据进行相加，如相加的结果大于10，则需要对下一位指针相加后的结果加1。</p>
<h2 id="解题思路"><a href="#解题思路" class="headerlink" title="解题思路"></a>解题思路</h2><h3 id="方法一：递归累加法"><a href="#方法一：递归累加法" class="headerlink" title="方法一：递归累加法"></a>方法一：递归累加法</h3><ol>
<li>对两个链表同时进行递归操作，将两个链表累加的值存入待输出的链表中</li>
<li>需要判断累加的值是否超过了10，如超过了10，则下一次递归的时候需要进位操作（即将结果在加1）</li>
<li>当某一个链表递归结束时，则递归终止，将另一方链表的剩余节点添加到待输出链表中。</li>
<li>时间复杂度： O(n)</li>
</ol>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 解题思路：</span></span><br><span class="line"><span class="comment"> * 1.利用引用传值的特点，递归累加</span></span><br><span class="line"><span class="comment"> * 2.bit表示数字相加和大于10的进位</span></span><br><span class="line"><span class="comment"> * &lt;p&gt;</span></span><br><span class="line"><span class="comment"> * 执行耗时:1 ms,击败了100.00% 的Java用户</span></span><br><span class="line"><span class="comment"> * 内存消耗:41.1 MB,击败了10.30% 的Java用户</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> ListNode <span class="title function_">addTwoNumbers</span><span class="params">(ListNode l1, ListNode l2)</span> &#123;</span><br><span class="line">    <span class="type">ListNode</span> <span class="variable">rootNode</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ListNode</span>();</span><br><span class="line">    <span class="comment">// 递归操作，将结果保存在rootNode中</span></span><br><span class="line">    addTwoNumbers(rootNode, l1, l2, <span class="number">0</span>);</span><br><span class="line">    <span class="keyword">return</span> rootNode;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 进行递归累加的方法</span></span><br><span class="line"><span class="comment"> *</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> node 待输出链表</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> l1   链表1</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> l2   链表2</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@param</span> bit  进位标志，如果相加结果超过10，则该值为1</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">private</span> <span class="keyword">void</span> <span class="title function_">addTwoNumbers</span><span class="params">(ListNode node, ListNode l1, ListNode l2, <span class="type">int</span> bit)</span> &#123;</span><br><span class="line">    <span class="type">int</span> <span class="variable">l1Val</span> <span class="operator">=</span> <span class="number">0</span>, l2Val = <span class="number">0</span>;</span><br><span class="line">    <span class="comment">// 获取链表1的值</span></span><br><span class="line">    <span class="keyword">if</span> (l1 != <span class="literal">null</span>) &#123;</span><br><span class="line">        l1Val = l1.val;</span><br><span class="line">        l1 = l1.next;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">// 获取链表2的值</span></span><br><span class="line">    <span class="keyword">if</span> (l2 != <span class="literal">null</span>) &#123;</span><br><span class="line">        l2Val = l2.val;</span><br><span class="line">        l2 = l2.next;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 计算值相加</span></span><br><span class="line">    <span class="type">int</span> <span class="variable">val</span> <span class="operator">=</span> l1Val + l2Val + bit;</span><br><span class="line">    bit = val / <span class="number">10</span>;</span><br><span class="line">    val %= <span class="number">10</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 相加结果取模后放入待输出链表中</span></span><br><span class="line">    node.val = val;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 递归结束条件：所有链表遍历完成，且进位标记为0</span></span><br><span class="line">    <span class="keyword">if</span> (l1 == <span class="literal">null</span> &amp;&amp; l2 == <span class="literal">null</span> &amp;&amp; bit == <span class="number">0</span>) &#123;</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">// 递归累加</span></span><br><span class="line">    <span class="type">ListNode</span> <span class="variable">nextNode</span> <span class="operator">=</span> <span class="keyword">new</span> <span class="title class_">ListNode</span>();</span><br><span class="line">    node.next = nextNode;</span><br><span class="line">    addTwoNumbers(nextNode, l1, l2, bit);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>单链表中每个节点会存储下一个节点的指针，因此输出时只需要将头节点输出即可。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div>请博主喝咖啡</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/weixin.jpg" alt="Wisdomelon 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/images/zhifubao.jpg" alt="Wisdomelon 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Wisdomelon
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://www.wisdomelon.com/leetcode-2-%E4%B8%A4%E6%95%B0%E7%9B%B8%E5%8A%A0/" title="leetcode-[2]两数相加">https://www.wisdomelon.com/leetcode-2-两数相加/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/java/" rel="tag"><i class="fa fa-tag"></i> java</a>
              <a href="/tags/leetcode/" rel="tag"><i class="fa fa-tag"></i> leetcode</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/leetcode-1-%E4%B8%A4%E6%95%B0%E4%B9%8B%E5%92%8C/" rel="prev" title="leetcode-[1]两数之和">
                  <i class="fa fa-chevron-left"></i> leetcode-[1]两数之和
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/Java%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-00%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E6%A6%82%E8%BF%B0/" rel="next" title="Java设计模式-[00]设计模式概述">
                  Java设计模式-[00]设计模式概述 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 2018 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">wisdomelon.com 版权所有 湘ICP备18022885</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">7k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">6 分钟</span>
  </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script size="300" alpha="0.6" zIndex="-1" src="https://cdnjs.cloudflare.com/ajax/libs/ribbon.js/1.0.2/ribbon.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  
<script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.0/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>



  <script src="/js/third-party/fancybox.js"></script>


  


  <script class="next-config" data-name="leancloud_visitors" type="application/json">{"enable":true,"app_id":"Dxd5q4sw952kfiPpg8bJ45Kn-MdYXbMMI","app_key":"DENRJ6lE8ewxELIuVqcbSBSH","server_url":"https://dxd5q4sw.api.lncldglobal.com","security":false,"betterPerformance":false}</script>
  <script src="/js/third-party/statistics/lean-analytics.js"></script>



</body>
</html>
